优化统计结构;新增预警统计
This commit is contained in:
parent
dc63151030
commit
e24c52a4e2
|
@ -11,7 +11,7 @@ public enum SituationEnum {
|
||||||
*/
|
*/
|
||||||
NONE(1, "未见异常"),
|
NONE(1, "未见异常"),
|
||||||
LOW(2, "低风险"),
|
LOW(2, "低风险"),
|
||||||
MIDDEL(3, "中风险"),
|
MIDDLE(3, "中风险"),
|
||||||
HIGH(4, "高风险"),
|
HIGH(4, "高风险"),
|
||||||
MAJOR(5, "重大风险");
|
MAJOR(5, "重大风险");
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package org.dromara.scale.controller;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.scale.domain.vo.StatisticCompleteVo;
|
||||||
|
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||||
|
import org.dromara.scale.service.IStatisticService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>统计<p>
|
||||||
|
*
|
||||||
|
* @author cjw
|
||||||
|
* @version V1.0.0
|
||||||
|
* @date 2024/4/21 16:22
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/scale/statistic")
|
||||||
|
public class StatisticController extends BaseController {
|
||||||
|
|
||||||
|
private final IStatisticService statisticService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取完成情况统计
|
||||||
|
*/
|
||||||
|
@GetMapping("/complete/all")
|
||||||
|
public R<StatisticCompleteVo> getComplete(Long batchNo, Long scaleId) {
|
||||||
|
return R.ok(statisticService.getComplete4All(batchNo, scaleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取完成情况统计
|
||||||
|
*/
|
||||||
|
@GetMapping("/complete/class")
|
||||||
|
public R<List<StatisticCompleteVo>> getComplete4Class(Long batchNo, Long scaleId) {
|
||||||
|
return R.ok(statisticService.getComplete4Class(batchNo, scaleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取完成情况统计
|
||||||
|
*/
|
||||||
|
@GetMapping("/warn/all")
|
||||||
|
public R<StatisticWarnVo> getWarn(Long batchNo, Long scaleId) {
|
||||||
|
return R.ok(statisticService.getWarn4All(batchNo, scaleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取完成情况统计
|
||||||
|
*/
|
||||||
|
@GetMapping("/warn/class")
|
||||||
|
public R<List<StatisticWarnVo>> getWarn4Class(Long batchNo, Long scaleId) {
|
||||||
|
return R.ok(statisticService.getWarn4Class(batchNo, scaleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,12 +2,10 @@ package org.dromara.scale.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
@ -80,23 +78,23 @@ public class SysInterveneRecordController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 修改干预记录
|
* 修改干预记录
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("scale:intervene:edit")
|
// @SaCheckPermission("scale:intervene:edit")
|
||||||
@Log(title = "干预记录", businessType = BusinessType.UPDATE)
|
// @Log(title = "干预记录", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
// @RepeatSubmit()
|
||||||
@PutMapping()
|
// @PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysInterveneRecordBo bo) {
|
// public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysInterveneRecordBo bo) {
|
||||||
return toAjax(sysInterveneRecordService.updateByBo(bo));
|
// return toAjax(sysInterveneRecordService.updateByBo(bo));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除干预记录
|
* 删除干预记录
|
||||||
*
|
*
|
||||||
* @param interveneIds 主键串
|
* @param interveneIds 主键串
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("scale:intervene:remove")
|
// @SaCheckPermission("scale:intervene:remove")
|
||||||
@Log(title = "干预记录", businessType = BusinessType.DELETE)
|
// @Log(title = "干预记录", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{interveneIds}")
|
// @DeleteMapping("/{interveneIds}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] interveneIds) {
|
// public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] interveneIds) {
|
||||||
return toAjax(sysInterveneRecordService.deleteWithValidByIds(List.of(interveneIds), true));
|
// return toAjax(sysInterveneRecordService.deleteWithValidByIds(List.of(interveneIds), true));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,10 @@
|
||||||
package org.dromara.scale.controller;
|
package org.dromara.scale.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.scale.domain.bo.SysScaleAnswerBo;
|
|
||||||
import org.dromara.scale.domain.vo.SysScaleAnswerVo;
|
|
||||||
import org.dromara.scale.service.ISysScaleAnswerService;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选项信息
|
* 选项信息
|
||||||
|
@ -29,7 +18,7 @@ import java.util.List;
|
||||||
@RequestMapping("/scale/answer")
|
@RequestMapping("/scale/answer")
|
||||||
public class SysScaleAnswerController extends BaseController {
|
public class SysScaleAnswerController extends BaseController {
|
||||||
|
|
||||||
private final ISysScaleAnswerService sysScaleAnswerService;
|
//private final ISysScaleAnswerService sysScaleAnswerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询选项信息列表
|
* 查询选项信息列表
|
||||||
|
@ -43,23 +32,23 @@ public class SysScaleAnswerController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 导出选项信息列表
|
* 导出选项信息列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("scale:answer:export")
|
// @SaCheckPermission("scale:answer:export")
|
||||||
@Log(title = "选项信息", businessType = BusinessType.EXPORT)
|
// @Log(title = "选项信息", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
// @PostMapping("/export")
|
||||||
public void export(SysScaleAnswerBo bo, HttpServletResponse response) {
|
// public void export(SysScaleAnswerBo bo, HttpServletResponse response) {
|
||||||
List<SysScaleAnswerVo> list = sysScaleAnswerService.queryList(bo);
|
// List<SysScaleAnswerVo> list = sysScaleAnswerService.queryList(bo);
|
||||||
ExcelUtil.exportExcel(list, "选项信息", SysScaleAnswerVo.class, response);
|
// ExcelUtil.exportExcel(list, "选项信息", SysScaleAnswerVo.class, response);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取选项信息详细信息
|
* 获取选项信息详细信息
|
||||||
*
|
*
|
||||||
* @param answerId 主键
|
* @param answerId 主键
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("scale:answer:query")
|
// @SaCheckPermission("scale:answer:query")
|
||||||
@GetMapping("/{answerId}")
|
// @GetMapping("/{answerId}")
|
||||||
public R<SysScaleAnswerVo> getInfo(@NotNull(message = "主键不能为空")
|
// public R<SysScaleAnswerVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Long answerId) {
|
// @PathVariable Long answerId) {
|
||||||
return R.ok(sysScaleAnswerService.queryById(answerId));
|
// return R.ok(sysScaleAnswerService.queryById(answerId));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,5 +109,4 @@ public class SysScaleFactorController extends BaseController {
|
||||||
return toAjax(sysScaleFactorService.deleteWithValidByIds(List.of(factorIds), true));
|
return toAjax(sysScaleFactorService.deleteWithValidByIds(List.of(factorIds), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
||||||
import org.dromara.scale.domain.vo.StatisticVo;
|
import org.dromara.scale.domain.vo.EvaluationVo;
|
||||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||||
import org.dromara.scale.service.ISysScalePublishService;
|
import org.dromara.scale.service.ISysScalePublishService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -93,20 +93,11 @@ public class SysScalePublishController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取量测记录统计
|
* 获取量测进度
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("evaluation:record:query")
|
@SaCheckPermission("evaluation:record:query")
|
||||||
@GetMapping("/statistic/all")
|
@GetMapping("/evaluation/list")
|
||||||
public R<StatisticVo> getStatistic(Long batchNo, Long scale) {
|
public R<List<EvaluationVo>> getEvaluationList(Long batchNo, Long scaleId) {
|
||||||
return R.ok(sysScalePublishService.getStatistic4All(batchNo, scale));
|
return R.ok(sysScalePublishService.getEvaluationList(batchNo, scaleId));
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取量测记录统计
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("evaluation:record:query")
|
|
||||||
@GetMapping("/statistic/class")
|
|
||||||
public R<List<StatisticVo>> getStatistic4Class(Long batchNo, Long scale) {
|
|
||||||
return R.ok(sysScalePublishService.getStatistic4Class(batchNo, scale));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,13 @@ public class SysWarnRecordController extends BaseController {
|
||||||
return toAjax(sysWarnRecordService.updateByBo(bo));
|
return toAjax(sysWarnRecordService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SaCheckPermission("sacle:warn:query")
|
/**
|
||||||
|
* 查询预警下的量测记录
|
||||||
|
*
|
||||||
|
* @param warnId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("scale:warn:query")
|
||||||
@GetMapping("/evaluation/record")
|
@GetMapping("/evaluation/record")
|
||||||
public R<List<SysEvaluationRecordVo>> getEvaluationRecordList(@NotNull(message = "主键不能为空") Long warnId) {
|
public R<List<SysEvaluationRecordVo>> getEvaluationRecordList(@NotNull(message = "主键不能为空") Long warnId) {
|
||||||
return R.ok(sysWarnRecordService.queryConclusionListByWarnId(warnId));
|
return R.ok(sysWarnRecordService.queryConclusionListByWarnId(warnId));
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package org.dromara.scale.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>量测进度<p>
|
||||||
|
*
|
||||||
|
* @author cjw
|
||||||
|
* @version V1.0.0
|
||||||
|
* @date 2024/4/21 15:44
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EvaluationVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
private Long recordId;
|
||||||
|
|
||||||
|
private Long scaleId;
|
||||||
|
|
||||||
|
private String scaleName;
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
private Boolean used;
|
||||||
|
|
||||||
|
}
|
|
@ -2,15 +2,21 @@ package org.dromara.scale.domain.vo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>统计实体<p>
|
* <p>统计完成<p>
|
||||||
*
|
*
|
||||||
* @author cjw
|
* @author cjw
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
* @date 2024/4/17 15:21
|
* @date 2024/4/17 15:21
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class StatisticVo {
|
public class StatisticCompleteVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.dromara.scale.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>统计预警<p>
|
||||||
|
*
|
||||||
|
* @author cjw
|
||||||
|
* @version V1.0.0
|
||||||
|
* @date 2024/4/21 16:31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatisticWarnVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
private Integer noneNum;
|
||||||
|
private Integer lowNum;
|
||||||
|
private Integer middleNum;
|
||||||
|
private Integer highNum;
|
||||||
|
private Integer majorNum;
|
||||||
|
}
|
|
@ -4,7 +4,9 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import org.dromara.scale.domain.SysScalePublish;
|
import org.dromara.scale.domain.SysScalePublish;
|
||||||
import org.dromara.scale.domain.vo.StatisticVo;
|
import org.dromara.scale.domain.vo.EvaluationVo;
|
||||||
|
import org.dromara.scale.domain.vo.StatisticCompleteVo;
|
||||||
|
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -18,12 +20,20 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysScalePublishMapper extends BaseMapperPlus<SysScalePublish, SysScalePublishVo> {
|
public interface SysScalePublishMapper extends BaseMapperPlus<SysScalePublish, SysScalePublishVo> {
|
||||||
|
|
||||||
StatisticVo selectSingleAllAvaluation(Long batchNo);
|
StatisticCompleteVo selectSingleAllAvaluation(Long batchNo);
|
||||||
|
|
||||||
StatisticVo selectSingleAlreadyAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
StatisticCompleteVo selectSingleCompleteAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
|
|
||||||
|
|
||||||
List<StatisticVo> selectAllAvaluation(Long batchNo);
|
List<StatisticCompleteVo> selectAllAvaluation(Long batchNo);
|
||||||
|
|
||||||
List<StatisticVo> selectAlreadyAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
List<StatisticCompleteVo> selectCompleteAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
|
|
||||||
|
List<EvaluationVo> selectEvaluationVoList(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
|
|
||||||
|
List<EvaluationVo> selectEvaluationVoList4Parent(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
|
|
||||||
|
StatisticWarnVo selectStatisticWarn(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
|
|
||||||
|
List<StatisticWarnVo> selectStatisticWarn4Class(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.dromara.scale.service;
|
||||||
|
|
||||||
|
import org.dromara.scale.domain.vo.StatisticCompleteVo;
|
||||||
|
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IStatisticService {
|
||||||
|
|
||||||
|
|
||||||
|
StatisticCompleteVo getComplete4All(Long batchNo, Long scaleId);
|
||||||
|
|
||||||
|
List<StatisticCompleteVo> getComplete4Class(Long batchNo, Long scaleId);
|
||||||
|
|
||||||
|
|
||||||
|
StatisticWarnVo getWarn4All(Long batchNo, Long scaleId);
|
||||||
|
|
||||||
|
List<StatisticWarnVo> getWarn4Class(Long batchNo, Long scaleId);
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ package org.dromara.scale.service;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
||||||
import org.dromara.scale.domain.vo.StatisticVo;
|
import org.dromara.scale.domain.vo.EvaluationVo;
|
||||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -47,7 +47,7 @@ public interface ISysScalePublishService {
|
||||||
*/
|
*/
|
||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
StatisticVo getStatistic4All(Long batchNo,Long scale);
|
|
||||||
|
|
||||||
List<StatisticVo> getStatistic4Class(Long batchNo,Long scale);
|
List<EvaluationVo> getEvaluationList(Long batchNo,Long scaleId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
package org.dromara.scale.service.impl;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.scale.domain.vo.StatisticCompleteVo;
|
||||||
|
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||||
|
import org.dromara.scale.mapper.SysScalePublishMapper;
|
||||||
|
import org.dromara.scale.service.IStatisticService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>TODO<p>
|
||||||
|
*
|
||||||
|
* @author cjw
|
||||||
|
* @version V1.0.0
|
||||||
|
* @date 2024/4/21 16:24
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class StatisticService implements IStatisticService {
|
||||||
|
|
||||||
|
private final SysScalePublishMapper scalePublishMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StatisticCompleteVo getComplete4All(Long batchNo, Long scaleId) {
|
||||||
|
StatisticCompleteVo all = scalePublishMapper.selectSingleAllAvaluation(batchNo);
|
||||||
|
int total = all.getValue();
|
||||||
|
StatisticCompleteVo already = scalePublishMapper.selectSingleCompleteAvaluation(batchNo, scaleId);
|
||||||
|
int alreadyValue = already.getValue();
|
||||||
|
all.setSpareValue(total - alreadyValue);
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StatisticCompleteVo> getComplete4Class(Long batchNo, Long scaleId) {
|
||||||
|
List<StatisticCompleteVo> all = scalePublishMapper.selectAllAvaluation(batchNo);
|
||||||
|
Map<String, Integer> collect = all.stream().collect(Collectors.groupingBy(StatisticCompleteVo::getName,
|
||||||
|
Collectors.collectingAndThen(Collectors.mapping(StatisticCompleteVo::getValue, Collectors.toList()),
|
||||||
|
values -> values.get(0))));
|
||||||
|
List<StatisticCompleteVo> completeList = scalePublishMapper.selectCompleteAvaluation(batchNo, scaleId);
|
||||||
|
completeList.forEach(a -> {
|
||||||
|
String name = a.getName();
|
||||||
|
int total = collect.get(name);
|
||||||
|
a.setSpareValue(total - a.getValue());
|
||||||
|
});
|
||||||
|
return completeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StatisticWarnVo getWarn4All(Long batchNo, Long scaleId) {
|
||||||
|
return scalePublishMapper.selectStatisticWarn(batchNo, scaleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StatisticWarnVo> getWarn4Class(Long batchNo, Long scaleId) {
|
||||||
|
return scalePublishMapper.selectStatisticWarn4Class(batchNo, scaleId);
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,18 +18,19 @@ import org.dromara.common.redis.utils.QueueUtils;
|
||||||
import org.dromara.scale.constant.StatusEnum;
|
import org.dromara.scale.constant.StatusEnum;
|
||||||
import org.dromara.scale.domain.SysScalePublish;
|
import org.dromara.scale.domain.SysScalePublish;
|
||||||
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
||||||
import org.dromara.scale.domain.vo.StatisticVo;
|
import org.dromara.scale.domain.vo.EvaluationVo;
|
||||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||||
import org.dromara.scale.domain.vo.SysScaleVo;
|
import org.dromara.scale.domain.vo.SysScaleVo;
|
||||||
import org.dromara.scale.mapper.SysScaleMapper;
|
import org.dromara.scale.mapper.SysScaleMapper;
|
||||||
import org.dromara.scale.mapper.SysScalePublishMapper;
|
import org.dromara.scale.mapper.SysScalePublishMapper;
|
||||||
import org.dromara.scale.service.ISysScalePublishService;
|
import org.dromara.scale.service.ISysScalePublishService;
|
||||||
|
import org.dromara.system.domain.vo.SysDeptVo;
|
||||||
|
import org.dromara.system.mapper.SysDeptMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -47,7 +48,9 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
||||||
|
|
||||||
private final SysScalePublishMapper baseMapper;
|
private final SysScalePublishMapper baseMapper;
|
||||||
|
|
||||||
private final SysScaleMapper sysScaleMapper;
|
private final SysScaleMapper scaleMapper;
|
||||||
|
|
||||||
|
private final SysDeptMapper deptMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询量发布
|
* 查询量发布
|
||||||
|
@ -107,12 +110,12 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
||||||
throw new ServiceException("截止日期必须在六小时后");
|
throw new ServiceException("截止日期必须在六小时后");
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(bo.getScaleIds())) {
|
if (CollUtil.isNotEmpty(bo.getScaleIds())) {
|
||||||
List<SysScaleVo> list = sysScaleMapper.findSysScaleByIds(StrUtil.join(StrUtil.COMMA, bo.getScaleIds()));
|
List<SysScaleVo> list = scaleMapper.findSysScaleByIds(StrUtil.join(StrUtil.COMMA, bo.getScaleIds()));
|
||||||
add.setScaleNames(list.stream().map(SysScaleVo::getScaleName).collect(Collectors.joining(StrUtil.COMMA)));
|
add.setScaleNames(list.stream().map(SysScaleVo::getScaleName).collect(Collectors.joining(StrUtil.COMMA)));
|
||||||
|
|
||||||
//List<SysScale> scaleList = new ArrayList<>(bo.getScaleIds().size());
|
//List<SysScale> scaleList = new ArrayList<>(bo.getScaleIds().size());
|
||||||
for (String scaleId : bo.getScaleIds()) {
|
for (String scaleId : bo.getScaleIds()) {
|
||||||
sysScaleMapper.updatePublishNums(Long.parseLong(scaleId));
|
scaleMapper.updatePublishNums(Long.parseLong(scaleId));
|
||||||
// SysScale sysScale = sysScaleMapper.selectById(scaleId);
|
// SysScale sysScale = sysScaleMapper.selectById(scaleId);
|
||||||
// sysScale.setPublishNums(sysScale.getPublishNums() + 1);
|
// sysScale.setPublishNums(sysScale.getPublishNums() + 1);
|
||||||
// scaleList.add(sysScale);
|
// scaleList.add(sysScale);
|
||||||
|
@ -163,35 +166,33 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
||||||
return baseMapper.deleteBatchIds(ids) > 0;
|
return baseMapper.deleteBatchIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 统计本场次
|
|
||||||
*
|
|
||||||
* @param batchNo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public StatisticVo getStatistic4All(Long batchNo, Long scale) {
|
public List<EvaluationVo> getEvaluationList(Long batchNo, Long scaleId) {
|
||||||
//SysScalePublishVo sysScalePublishVo = baseMapper.selectVoById(batchNo);
|
SysScalePublishVo scalePublishVo = baseMapper.selectVoById(batchNo);
|
||||||
StatisticVo all = baseMapper.selectSingleAllAvaluation(batchNo);
|
Long deptId = scalePublishVo.getDeptId();
|
||||||
int total = all.getValue();
|
//为父级
|
||||||
StatisticVo already = baseMapper.selectSingleAlreadyAvaluation(batchNo, scale);
|
List<EvaluationVo> evaluationVos;
|
||||||
int alreadyValue = already.getValue();
|
if (isParent(deptId)) {
|
||||||
all.setSpareValue(total - alreadyValue);
|
evaluationVos = baseMapper.selectEvaluationVoList4Parent(batchNo, scaleId);
|
||||||
return all;
|
} else {
|
||||||
|
evaluationVos = baseMapper.selectEvaluationVoList(batchNo, scaleId);
|
||||||
|
}
|
||||||
|
SysScaleVo sysScaleVo = scaleMapper.selectVoById(scaleId);
|
||||||
|
evaluationVos.forEach(e -> {
|
||||||
|
e.setScaleId(scaleId);
|
||||||
|
e.setScaleName(sysScaleVo.getScaleName());
|
||||||
|
e.setUsed(e.getRecordId() != null);
|
||||||
|
});
|
||||||
|
return evaluationVos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private boolean isParent(Long deptId) {
|
||||||
public List<StatisticVo> getStatistic4Class(Long batchNo, Long scale) {
|
SysDeptVo dept = deptMapper.selectDeptById(deptId);
|
||||||
List<StatisticVo> all = baseMapper.selectAllAvaluation(batchNo);
|
List<String> split = StrUtil.split(dept.getAncestors(), StringUtils.SEPARATOR);
|
||||||
Map<String, Integer> collect = all.stream().collect(Collectors.groupingBy(StatisticVo::getName,
|
if (split.size() <= 2) {
|
||||||
Collectors.collectingAndThen(Collectors.mapping(StatisticVo::getValue, Collectors.toList()),
|
return true;
|
||||||
values -> values.get(0))));
|
} else {
|
||||||
List<StatisticVo> alreadyList = baseMapper.selectAlreadyAvaluation(batchNo, scale);
|
return false;
|
||||||
alreadyList.forEach(a -> {
|
}
|
||||||
String name = a.getName();
|
|
||||||
int total = collect.get(name);
|
|
||||||
a.setSpareValue(total - a.getValue());
|
|
||||||
});
|
|
||||||
return alreadyList;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,41 +3,99 @@
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.dromara.scale.mapper.SysScalePublishMapper">
|
<mapper namespace="org.dromara.scale.mapper.SysScalePublishMapper">
|
||||||
<select id="selectSingleAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticVo">
|
<select id="selectSingleAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticCompleteVo">
|
||||||
select d.dept_name as `name`, count(u.user_id) as `value`
|
select d.dept_name as `name`, count(u.user_id) as `value`
|
||||||
from sys_scale_publish sp
|
from sys_scale_publish sp
|
||||||
left join sys_dept d on sp.dept_id = d.dept_id
|
left join sys_dept d on d.dept_id = sp.dept_id
|
||||||
left join sys_user u on d.dept_id = u.dept_id and u.user_type = 'student'
|
left join sys_user u on find_in_set(u.dept_id, d.ancestors) and u.user_type = 'student'
|
||||||
where sp.batch_no = #{batchNo}
|
where sp.batch_no = #{batchNo}
|
||||||
group by d.dept_id
|
group by d.dept_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSingleAlreadyAvaluation" resultType="org.dromara.scale.domain.vo.StatisticVo">
|
<select id="selectSingleCompleteAvaluation" resultType="org.dromara.scale.domain.vo.StatisticCompleteVo">
|
||||||
select d.dept_name as `name`, count(er.record_id) as `value`
|
select d.dept_name as `name`, count(er.record_id) as `value`
|
||||||
from sys_scale_publish sp
|
from sys_scale_publish sp
|
||||||
left join sys_dept d on sp.dept_id = d.dept_id
|
left join sys_dept d on d.dept_id = sp.dept_id
|
||||||
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
||||||
where sp.batch_no = #{batchNo}
|
where sp.batch_no = #{batchNo}
|
||||||
and er.scale_id = #{scaleId}
|
and er.scale_id = #{scaleId}
|
||||||
group by d.dept_id
|
group by d.dept_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticVo">
|
<select id="selectAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticCompleteVo">
|
||||||
select d.dept_name as `name`, count(u.user_id) as `value`
|
select d.dept_name as `name`, count(u.user_id) as `value`
|
||||||
from sys_scale_publish sp
|
from sys_scale_publish sp
|
||||||
left join sys_dept d on sp.dept_id = d.parent_id
|
left join sys_dept d on d.parent_id = sp.dept_id
|
||||||
left join sys_user u on d.dept_id = u.dept_id and u.user_type = 'student'
|
left join sys_user u on u.dept_id = d.dept_id and u.user_type = 'student'
|
||||||
where sp.batch_no = #{batchNo}
|
where sp.batch_no = #{batchNo}
|
||||||
group by d.dept_id
|
group by d.dept_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAlreadyAvaluation" resultType="org.dromara.scale.domain.vo.StatisticVo">
|
<select id="selectCompleteAvaluation" resultType="org.dromara.scale.domain.vo.StatisticCompleteVo">
|
||||||
select d.dept_name as `name`, count(er.record_id) as `value`
|
select d.dept_name as `name`, count(er.record_id) as `value`
|
||||||
from sys_scale_publish sp
|
from sys_scale_publish sp
|
||||||
left join sys_dept d on sp.dept_id = d.parent_id
|
left join sys_dept d on d.parent_id = sp.dept_id
|
||||||
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
||||||
where sp.batch_no = #{batchNo}
|
where sp.batch_no = #{batchNo}
|
||||||
and er.scale_id = #{scaleId}
|
and er.scale_id = #{scaleId}
|
||||||
group by d.dept_id
|
group by d.dept_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEvaluationVoList" resultType="org.dromara.scale.domain.vo.EvaluationVo">
|
||||||
|
select d.dept_id,
|
||||||
|
d.dept_name,
|
||||||
|
u.user_id,
|
||||||
|
u.nick_name,
|
||||||
|
er.record_id
|
||||||
|
from sys_scale_publish sp
|
||||||
|
left join sys_dept d on d.dept_id = sp.dept_id
|
||||||
|
left join sys_user u on u.dept_id = d.dept_id and u.user_type = 'student'
|
||||||
|
left join sys_evaluation_record er on er.user_id = u.user_id and er.scale_id = #{scaleId}
|
||||||
|
where sp.batch_no = #{batchNo}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEvaluationVoList4Parent" resultType="org.dromara.scale.domain.vo.EvaluationVo">
|
||||||
|
select d.dept_id, d.dept_name, u.user_id, u.nick_name, er.record_id
|
||||||
|
from sys_scale_publish sp
|
||||||
|
left join sys_dept d on d.parent_id = sp.dept_id
|
||||||
|
left join sys_user u on u.dept_id = d.dept_id and u.user_type = 'student'
|
||||||
|
left join sys_evaluation_record er on er.user_id = u.user_id and er.scale_id = #{scaleId}
|
||||||
|
where sp.batch_no = #{batchNo}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectStatisticWarn" resultType="org.dromara.scale.domain.vo.StatisticWarnVo">
|
||||||
|
select d.dept_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
|
||||||
|
from sys_scale_publish sp
|
||||||
|
left join sys_dept d on d.dept_id = sp.dept_id
|
||||||
|
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
||||||
|
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 sp.batch_no = #{batchNo}
|
||||||
|
and er.scale_id = #{scaleId}
|
||||||
|
and ec.status = 1
|
||||||
|
group by d.dept_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectStatisticWarn4Class" resultType="org.dromara.scale.domain.vo.StatisticWarnVo">
|
||||||
|
select d.dept_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
|
||||||
|
from sys_scale_publish sp
|
||||||
|
left join sys_dept d on d.parent_id = sp.dept_id
|
||||||
|
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
||||||
|
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 sp.batch_no = #{batchNo}
|
||||||
|
and er.scale_id = #{scaleId}
|
||||||
|
and ec.status = 1
|
||||||
|
group by d.dept_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue